//1. 引入 React
import React from 'react';
//2. 引入 ReactDOM
import ReactDOM from 'react-dom';
import {BrowserRouter} from 'react-router-dom';
//3. 创建虚拟 DOM 对象
// let vDOM = <h1>Hello React 脚手架</h1>;
//声明一个类式组件
import App from './App';
//引入 store 仓库对象
import store from './redux/store';

//4. 渲染
ReactDOM.render(
    <BrowserRouter>
        <App />
    </BrowserRouter>, document.querySelector('#root'));

//当状态发生改变时, 重新渲染组件
store.subscribe(() => {
    ReactDOM.render(
        <BrowserRouter>
            <App />
        </BrowserRouter>, document.querySelector('#root'));
});